package by.semerikov.parts;

public class Code {
	static public Integer[] codes = {100,101,102,200,201,202,203,204,205,206,207,300,301,302,303,304,305,306,307,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,422,423,424,425,426,449,450,500,501,502,503,504,505,506,507,509,510};
	private Integer code;
	
	public Code()
	{
		
	}
	public Code(int code)
	{
		this.setCode(code);
	}
	
	public int getCode() {
		return code;
	}
	public void setCode(int codeNumber) {
		this.code = codes[codeNumber];
	}
	
	public void setCodeByValue(int code) {
		for (int i = 0; i < codes.length; i++) {
			if(codes[i] == code)
			{
				this.code = i;
			}
		}
	}
	
	@Override
	public String toString()
	{
		return codes[code].toString();
	}
}
